<!doctype html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport"
        content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <meta name="format-detection" content="telephone=no">
  <meta http-equiv="x-rim-auto-match" content="none">
  <title>支付宝付款</title>
  <script src="${request.contextPath}/statics/js/jquery.js"></script>
  <script src="${request.contextPath}/statics/js/qrcode.min.js"></script>
  <script src="https://cdn.bootcss.com/layer/2.3/layer.js"></script>
  <style>
    * {
      padding: 0;
      margin: 0;
    }
    a {
      text-decoration: none;
    }

    .clearfix1:after {
      content: '';
      height: 0;
      line-height: 0;
      visibility: hidden;
      display: block;
      clear: both;
    }

    .clearfix1 {
      zoom: 1;
    }

    html, body {
      background-color: #EDEDED;
    }

    .page {
      width: 660px;
      margin: 0 auto 24px;
      background-color: #ffffff;
    }

    .header {
      position: relative;
      text-align: center;
      height: 67px;
      line-height: 67px;
      vertical-align: middle;
      overflow: hidden;
      padding: 10px 0;
    }
    .header .img {
      width: 26%;
      display: inline-block;
    }
    .header img {
      width: 100%;
      vertical-align: middle;
    }

    .main {
      overflow: hidden;
    }

    .main .money {
      margin: 36px auto;
      height: 21px;
      line-height: 21px;
      color: #ff0000;
      font-size: 30px;
      font-family: HelveticaNeue;
      text-align: center;
    }

    .main .qr {
      position: relative;
      width: 250px;
      height: 250px;
      margin: 0 auto;
      background: url("${request.contextPath}/statics/image/box.png") no-repeat;
      background-size: 100% 100%;
      border: 1px solid transparent;
    }
    .main .qr .ok {
      display: none;
      position: absolute;
      top: 26px;
      left: 26px;
      width: 200px;
      height: 200px;
      background: url("${request.contextPath}/statics/image/ok.png") no-repeat;
      background-size:100% 100%;

    }
    .main .qr #showqr {
      width: 200px;
      height: 200px;
      margin: 26px auto;
      /*background: url("images/qr.png") no-repeat;*/
      background-size: 100% 100%;
    }

    .main .qr .time {
      width: 176px;
      height: 28px;
      font-size: 22px;
      font-family: PingFangSC-Regular;
      position: absolute;
      top: -12px;
      left: 50%;
      transform: translateX(-50%);
      display: flex;
      align-items: center;
      justify-content: center;
    }

    .main .qr .txt {
      color: #999999;
      font-size: 14px;
      width: 150px;
      position: absolute;
      bottom: -6px;
      left: 50%;
      transform: translateX(-50%);
      display: flex;
      align-items: center;
      justify-content: center;
      text-align: center;
    }

    .green {
      color: #4EA5E9;
    }
    .save {
      display: none;
    }
    .main .order {
      margin: 21px auto 14px;
      text-align: center;
      font-size: 18px;
      color: #999999;
      font-family: PingFangSC-Medium;
    }

    .main .txt1 {
      letter-spacing: 1px;
      width: 60%;
      padding: 2% 0;
      text-align: center;
      margin: 0 auto 20px;
      color: #ffffff;
      font-size: 22px;
      /*font-weight: bold;*/
      font-family: PingFangSC-Regular;
      background: #4EA5E9;
      border-radius: 5px;
    }

    .main .footer {
      width: 80%;
      margin: 27px auto 0;
      border-top: 2px solid #dbdbdb;
      padding-top: 12px;
      font-size: 20px;
      color: #000;
    }
    .main .footer div {
      padding-left: 20px;
    }
    .main .footer .tip {
      float: left;
      display: inline-block;
      width: 20px;
      height: 20px;
      background: url("${request.contextPath}/statics/image/tip.png") no-repeat;
      background-size: 100% 100%;
    }

    .tip_txt {
      float: left;
      font-size: 20px;
      margin-left: 8px;
      color: #ff0000;
      display: inline-block;
      height: 18px;
      line-height: 18px;
    }

    .main .footer p {
      margin-bottom: 6px;
      padding-left: 20px;
      padding-bottom: 12px;
      border-bottom: 1px dotted #f1f1f1;
    }
    .mob {
      display: none;
    }
    @media (max-width: 640px) {
      @keyframes changeColor {
        0%{color: #d82b1e}
        50% {color: #e79739;}
        100%{color: #d82b1e}
      }
      .jiaocheng {
        animation: changeColor 1s infinite;
      }

      .page {
        width: 100%;
        margin: auto;
        background-color: #EDEDED;
      }
      .header {
        height: 50px;
        line-height: 50px;
        margin-top: 15px;
        padding: 0;
      }
      .header .img {
        width: 30%;
      }
      .header .jiaocheng {
        position: absolute;
        display: inline-block;
        top: 0;
        right: 5%;
      }
      .main .money {
        margin: 15px auto 35px;
      }
      .main .qr .time {
        font-size: 20px;
      }
      .main .order {
        font-size: 15px;
      }
      .main .order .save {
        display: block;
        font-weight: bold;
        font-size: 18px;
        color: #333333;
        margin-bottom: 10px;
      }
      .pc {
        display: none;
      }
      .mob {
        display: block;
      }
      .main .txt1 {
        width: 85%;
        padding: 3% 0;
        font-size: 18px;
        margin: 0 auto 10px;
        font-weight: bold;
        background-color: #4EA5E9;
      }
      .main .txt2 {
        /* color: #59BA36;
         background-color: #ffffff;*/
        font-weight: bold;
      }
      .main .footer {
        margin: 15px auto 0;
        font-size: 15px;
        width: 95%;
      }
      .main .footer div {
        padding-left: 15px;
      }
      .main .footer p {
        margin-bottom: 3px;
        padding-left: 15px;
        padding-bottom: 5px;
      }
      .main .footer .tip {
        width: 18px;
        height: 18px;
      }
      .tip_txt {
        font-size: 18px;
      }
    }
    .tanchu {
      background-color: transparent !important;
      box-shadow: none !important;
    }
    .tanchu .layui-layer-content {
      overflow: hidden !important;
    }
    .close {
      position: absolute;
      top: 0;
      right: 0;
      width: 40px;
      height: 40px;
      display: inline-block;
    }
  </style>
</head>

<body>
<div class="header page">
  <span class="img">
      <img src="${request.contextPath}/statics/image/logo.png" alt="">
  </span>
  <a class="mob jiaocheng" href="javascript:void (0)">扫码教程</a>
</div>
<div class="main page">
  <div class="money">
    <span>&yen;</span> <span id="money">${amount !''}</span>
  </div>
  <div class="qr clearfix1">
    <div class="ok"></div>
    <div id="showqr">
    </div>
    <div class="time">
      <div class="minute green">2</div>&nbsp;分&nbsp;<div class="second green">59</div>&nbsp;秒
    </div>
    <div class="txt">
      客官请稍等片刻
    </div>
  </div>
  <div class="order">
    <!-- <span class="save">请保留该页面截图直至付款成功</span> -->
    订单号：<span id="order">${orderid !''}</span>
  </div>
  <div class="order">
    <!-- <span style="color: red;"><b>扫码以后请付款${amount !''}元，付款成功，即时到账，付款其他金额不会到账！</b></span> -->
    <p style="color: black;"><b>支付宝姓名：<b style="color: red;dd">${name !''}</b></b></p><br>
    <p style="color: black;"><b>无需添加好友,扫码请直接转账付款<label style="color: red;font-size: 25px;">${amount !''}</label>元。</b></p><br>
    <p style="color: black;"><b>付款成功，会即时到账！如果付款其他金额不会到账！</b></p>
  </div>
  <div class="txt1">
    <span class="pc">打开支付宝扫一扫</span>
    <span class="mob">1、长按二维码或截屏保存至相册</span>
  </div>
  <div class="txt1 txt2 mob">2、打开支付宝扫一扫相册二维码 </div>

  <div class="footer">
    <div style="margin-bottom: 18px;overflow: hidden;"><span class="tip"></span><span class="tip_txt">温馨提示</span>
    </div>
    <p>1、请打开支付宝APP扫描二维码充值</p>
    <p>2、如付款失败,请重新生成二维码充值</p>
    <p>3、如充值没有到账,请联系在线客服</p>
  </div>

</div>
<div id="tanchu" style="display: none;">
  <img src="${request.contextPath}/statics/image/jiaocheng.png" alt="" usemap="#planetmap" style="width: 100%;">
  <map name="planetmap" id="planetmap"></map>
</div>
</body>
<script>
    var qrcode = new QRCode(document.getElementById("showqr"), {
        text: "${payurl !''}",
        width: 200,
        height: 200,
        colorDark : "#000000",
        colorLight : "#ffffff",
        correctLevel : QRCode.CorrectLevel.H
    });

    $('.jiaocheng').on('click',function () {
        layer.open({
            title: '二维码支付教程',
            area: '85%',
            offset: '30px',
            type: 1,
            closeBtn:1,
            shadeClose: false,
            scrollbar: false,
            resize:false,
            anim: -1,
            fixed: true,
            skin: 'tanchu',
            content: $('#tanchu')
        })
    })
</script>
<script>
    /*字体变换*/
    var text = document.querySelector('.txt');
    var txt_arr = ['确认过眼神你是我的菜','这个二维码很特别特别','充值未到账请联系客服','充值未成功请重新生成'];
    var num = 0;
    var timer_txt = setInterval(function () {
        text.innerText = txt_arr[num];
        num++;
        if (num === 4) {
            num = 0;
        }
    },1500)

    /*倒计时*/
    var minute = document.querySelector(".minute")
    var second = document.querySelector(".second")
    // 准备
    var countdownMinute = 3 //10分钟倒计时
    var startTimes = new Date() //开始时间
    var endTimes = new Date(startTimes.setMinutes(startTimes.getMinutes() + countdownMinute)) //结束时间
    var curTimes = new Date() //当前时间
    var surplusTimes = endTimes.getTime() / 1000 - curTimes.getTime() / 1000 //结束毫秒-开始毫秒=剩余倒计时间

    // 进入倒计时
    countdowns = window.setInterval( () => {
        surplusTimes--;
        var minu = Math.floor(surplusTimes / 60)
        var secd = Math.round(surplusTimes % 60)
        // console.log(minu+':'+secd)
        minu = minu <= 9 ? '0' + minu : minu
        secd = secd <= 9 ? '0' + secd : secd
        minute.innerHTML = minu
        second.innerHTML = secd
        // checkdata();
        if (surplusTimes <= 0) {
            alert('订单已过期,请勿支付,请重新发起订单！');
            window.history.go(-1);
            location.reload();
            clearInterval(countdowns)
        }
    },1000);

    var orderid = "${orderid !''}";
    setInterval(checkdata,3000);
    function checkdata(){
        $.ajax({
            type: 'GET',
            url: '${request.contextPath}/api/checkOrderStatus/'+orderid,
            dataType: 'json',
            success: function (str) {
                if (str.data == "ok") {
                    $("#showqr img").attr("src","${request.contextPath}/statics/image/pay_ok.png");
                    $("#money").text("支付成功");
                    setTimeout(function(){
                        closeWebPage();
                    }, 5000);
                }
            }
        });
    }

    function closeWebPage(){
        var userAgent = navigator.userAgent;
        if (userAgent.indexOf("Firefox") != -1 || userAgent.indexOf("Chrome") !=-1) {
            window.location.href="about:blank";
        }else if(userAgent.indexOf('Android') > -1 || userAgent.indexOf('Linux') > -1){
            window.opener=null;
            window.open('about:blank','_self','').close();
        }else {
            window.pener = null;
            window.open("about:blank", "_self");
            window.close();
        }
    }
    // $('.ok').show();
</script>
</html>